<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title> 修改密码 </title>
	<script type="text/javascript" src="../Ryanjs/login/style.js"></script>
        <link href="../Ryancss/login_public.css" rel="stylesheet" type="text/css"/>
        <link href="../Ryancss/login_style.css" rel="stylesheet" type="text/css"/>

</head>
<style>


 .aui-btn-default {
    float: right;
    position: absolute;
    right: 0px;
    top: 39px;
    z-index: 10002;
    color: #ffffff;
    background: none;
    border: none;
    margin-top: -35px;
    width: 100px;
    height: 40px;
}
 .aui-flex-border {
    border-radius: 50px;
    padding: 0;
    background: #f4f3f3;
	
} 
	   
	.aui-flex {
    display: -webkit-box;
    display: -webkit-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
	
	margin: 0 auto; 
    width: 90%;

}


.aui-flex-box {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #333;
}


.aui-flex-box input {
    border: none;
    background: none;
    font-size: 0.85rem;
    padding-left: 1.4rem;
    width: 100%;
}


.aui-button-once button {
    background-image: linear-gradient(to bottom,#a442ce,#b84dc7);
    background-color: #a241cf;
    box-shadow: 0 0 19px #dd7fe6;
    color: #fff;
    font-size: 0.4rem;
    padding: 0.1rem 0.2rem;
    border-radius: 20px;
    border: none;
    position: absolute;
    margin-top: -13%;
    right: 70px;
}  

</style>
<body>
<div class="main_login">

    <div class="tit">
        <span class="active_tit">修改密码</span>
        <span class="sp2" tapmode onclick="closeWin()" > << 返回</span>
        <div class="clear"></div>
    </div>

    <div class="main_box">

        <div class="box_con box_reg">
                <div class="con_bg">
              <!--      <span class="first_sp"><input  id="username" type="tel"  minlength="11" maxlength="11" placeholder="输入手机号码" ></span>  -->
<!--  <span class="first_sp" style="display :none;" id="display-block-dxyz"> <input id="yzcode" type="text" autocomplete="off" placeholder="短信验证码" /></span>
                            <div class="aui-button-once" id="btn1" onclick="getCode()">
                                <button>获取</button>
                            </div>  -->
                    <span class="second_sp thrid_sp"><input  id="password" type="password" placeholder="请输入新密码"/></span>
                    <span class="second_sp thrid_sp"><input  id="password_reg"  type="password" placeholder="请再次输入密码"/></span>
                </div>
                <a  onclick="toReg()" class="log_btn reg_btn">修改密码</a> 
   
        </div>
    </div>
	
	
    <div class="footer_pic">        

        <img src="" class="pic1"/>
  </div>
</div>


</body>

<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript">
    var api_url = localStorage.getItem('api_url');
    var onoff = true;
    var code_data = '';	
    apiready = function () {
      api.parseTapmode();  
      var header = $api.byId('aui-header');
      $api.fixStatusBar(header);
      var headerPos = $api.offset(header);
      var body_h = $api.offset($api.dom('body')).h;

      var username = $api.byId('username');    //获取用户
      username.value = localStorage.getItem('user_name');
	  
    <!-- if(localStorage.getItem('dxzce') == '0'){ -->

    <!-- }else{ -->

        <!-- var obj = document.getElementById("display-block-dxyz"); -->
        <!-- obj.setAttribute("style", "display :block;"); -->


    <!-- } -->
		
	  
    }
	
	
	
    function closeWin(){
        api.closeWin({
        });
    }


    function toReg(){
	
	
      var password = $api.val($api.byId('password'));
	  var password_reg = $api.val($api.byId('password_reg'));
      var username = localStorage.getItem('username');
      var yzcode = $api.val($api.byId('yzcode'));
      var user_id = localStorage.getItem('user_id');
      var lao_pswd = localStorage.getItem('password');
	  
      <!-- if(localStorage.getItem('dxzce') == '1'){ -->
	  	  			<!-- if (yzcode == '') { -->
				<!-- api.alert({ -->
					<!-- title: '警告！~', -->
					<!-- msg: '请输入验证码', -->
				<!-- }); -->
				<!-- return; -->
			<!-- } -->
	  <!-- } -->
      if(password == ''){

		
							api.toast({
							msg: '请输入新密码',
							duration: 5000,
							location : 'middle' 
						});	
				
        return;
      }

      if(password_reg == ''){

		
							api.toast({
							msg: '请再次输入密码',
							duration: 5000,
							location : 'middle' 
						});	
				
        return;
      }


      if(password.length < 5){
	  
							api.toast({
							msg: '请输入5位以上密码',
							duration: 5000,
							location : 'middle' 
						});			
			  

        return;
      }
	  
		  if ($api.byId('password').value != $api.byId('password_reg').value) {
                $api.byId('password_reg').focus();
                api.toast({
                    msg : '两次密码不一致，请检查!',
					duration: 5000,
					location : 'middle' 
                });
                return;
                 }  
	  
	  
      <!-- if(localStorage.getItem('dxzce') == '1'){ -->
	  
			<!-- var moduleSMSSDK = api.require('smssdk'); -->
			<!-- var param = { -->
				<!-- zone: '86', -->
				<!-- phoneNumber: username, -->
				<!-- code: yzcode -->
			<!-- }; -->
    <!-- moduleSMSSDK.commitCode(param, function(ret, err) {	 -->
	<!-- if (err !== null && err !== undefined && err !== '') { -->
					<!-- // 错误消息示例：{"msg":"Template not exist.","code":484} -->
		  <!-- api.toast({ -->
           <!-- msg : '验证码错误', -->
			<!-- duration: 5000, -->
			<!-- location : 'middle' -->
          <!-- }); -->
					<!-- return; -->
				<!-- }else{ -->
				      <!-- api.ajax({ -->
          <!-- url: api_url+'/login/login/repass.html', -->
          <!-- method: 'get', -->
          <!-- data: { -->
              <!-- values: { -->
                  <!-- username:localStorage.getItem('user_name'), -->
                  <!-- uid:localStorage.getItem('user_id'), -->
                  <!-- password:password, -->
                  <!-- key: 'ikmovie.xyz' -->
              <!-- } -->
          <!-- } -->
      <!-- },function(ret, err){ -->
          <!-- if (ret) { -->
		  
				<!-- if (ret.code == 0) { -->
	  
							<!-- api.toast({ -->
							<!-- msg: ret.msg, -->
							<!-- duration: 5000, -->
							<!-- location : 'middle'  -->
						<!-- });			 -->
			  	  			  
			  
			  <!-- }else if(ret.code == 1)  { -->
                <!-- localStorage.setItem('password',password); -->
				
				
				

							<!-- api.toast({ -->
							<!-- msg: '修改成功 请重新登录！', -->
							<!-- duration: 3000, -->
							<!-- location : 'middle'  -->
						<!-- });		 -->




				<!-- setTimeout("delayed()",1000);  //延迟执行 关闭 -->
			   
			   
			   
              <!-- } -->
          <!-- } else { -->

			
							<!-- api.toast({ -->
							<!-- msg: '网络错误！', -->
							<!-- duration: 5000, -->
							<!-- location : 'middle'  -->
						<!-- });			 -->
			  	  			  				
			
          <!-- } -->
      <!-- });} -->

	<!-- });	 -->
	  
	  
	  <!-- }	   -->

      api.ajax({
          url: api_url+'/login/login/repass.html',
          method: 'get',
          data: {
              values: {
                  username:localStorage.getItem('user_name'),
                  uid:localStorage.getItem('user_id'),
                  password:password,
                  key: 'ikmovie.xyz'
              }
          }
      },function(ret, err){
          if (ret) {
		  
				if (ret.code == 0) {
	  
							api.toast({
							msg: ret.msg,
							duration: 5000,
							location : 'middle' 
						});			
			  	  			  
			  
			  }else if(ret.code == 1)  {
                localStorage.setItem('password',password);
				
				
				

							api.toast({
							msg: '修改成功 请重新登录！',
							duration: 3000,
							location : 'middle' 
						});		




				setTimeout("delayed()",1000);  //延迟执行 关闭
			   
			   
			   
              }
          } else {

			
							api.toast({
							msg: '网络错误！',
							duration: 5000,
							location : 'middle' 
						});			
			  	  			  				
			
          }
      });
	  
 
	}



		//延时执行
	    function delayed(){	
		/*
                api.sendEvent({
                  name: 'outLogin',
                  extra: {
                  }
                });
				  
                  api.closeWin();
				  
				 */ 
				  
		  //退出登录

    api.sendEvent({
      name: 'newLoingdata',
      extra: {
      }
    });
	
    localStorage.setItem('user_id','');
    localStorage.setItem('user_name','');
    localStorage.setItem('user_time','');

    api.closeWin({
    });

		  
				  
				  

				}



  function closeWin(){
      api.closeWin({
      });
  }
  





	//获取验证码
		function getCode() {
			var yzcode = $api.val($api.byId('yzcode'));
			var btn1 = $api.byId('btn1');
			var username = $api.val($api.byId('username'));
			localStorage.setItem('reg_name', username);
			if (!onoff) {
				return;
			}
			onoff = false;

			if (username == '') {
				api.alert({
					title: '警告！',
					msg: '请输入手机号码',
				});
				onoff = true;
				return;
			}
			if (username.length != 11) {
				api.alert({
					title: '警告！',
					msg: '请输入11位手机号码',
				});
				onoff = true;
				return;
			}
			var moduleSMSSDK = api.require('smssdk');
			var param = {
				zone: '86',
				phoneNumber: username,
				tempCode: ''
			};
			moduleSMSSDK.getTextCode(param, function(ret, err) {
				if (err !== null && err !== undefined && err !== '') {
					// 错误消息示例：{"msg":"Template not exist.","code":484}
					alert("Error:\n" + JSON.stringify(err));
				} else {
					// 正常消息示例：{"smart":false}
					api.toast({
						msg: '发送成功',
						duration: 1000,
						location: 'middle'
					});
					var nuw = 60;
					var timer = setInterval(function() {
						nuw--;
                if (nuw < 1) {
                  btn1.innerHTML = '<button>获取</button>';
                  clearInterval(timer);
                  onoff = true;
                }else {
                  btn1.innerHTML = '<button>'+nuw+'s</button>';
                }
					}, 1000)
				}
			});


		}


    function openWin(name){
          var delay = 0;
          if(api.systemType != 'ios'){
              delay = 300;
          }
          api.openWin({
              name: ''+name+'',
              url: ''+name+'.html',
              bounces:false,
              delay: delay,
              slidBackEnabled:true,
              vScrollBarEnabled:false
          });
      }
</script>
</html>









